<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
		<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
		<title>现场实操的描述</title>
		<script src="../../script/mui.min.js"></script>
		<script src="../../script/jquery.min.js"></script>
		<script src="../../script/jquery.knob.js"></script>
		<link rel="stylesheet" href="../../css/mui.min.css" />
		<link rel="stylesheet" href="../../css/CFNetPP_Base.css">
		<link rel="stylesheet" href="../../css/base.css"/>
		<link rel="stylesheet" href="../../css/testscore.css"/>
		<link rel="stylesheet" type="text/css" href="../../css/api.css"/>
		<style>
			table {
				width: 100%;
				border: 1px solid #ddd;
			}
			table td {
				vertical-align: middle;
				border: 1px solid #ddd;
			}
			.cevt {
				text-align: center;
				font-size: 20px;
				margin-top: 30px;
			}
			p {
				font-size: 15px;
				line-height: 30px;
			}
		</style>
	</head>
	<body>
		<div id="htmls"></div>
		<div class="noSign" hidden="hidden" id="noData">
			<img src="../../image/icon_img.png" width="60%">
			<p class="font16 top_15 base_dark_grey" >
				暂无描述,请直接点击评分按钮
			</p>
		</div>
		<div class="loadFailure" hidden="hidden" id="noNet">
			<img src="../../image/icon_img01.png" width="60%">
			<p class="" >
				数据加载失败
			</p>
			<p>
				请检查您的网络
			</p>
			<button type="button" class="mui-btn mui-btn-outlined" onclick="loadNewData()">
				重新加载
			</button>
		</div>
	</body>
	<script type="text/javascript" src="../../script/api.js"></script>
	<script src="../../script/jquery.min.js"></script>
	<script type="text/javascript" src="../../script/api.js"></script>
	<script type="text/javascript" src="../../script/MD5.js"></script>
	<script src="../../script/common.js"></script>
	<script src="../../script/timeStampTool.js"></script>
	<script src="../../script/processing_images.js"></script>
	<script type="text/javascript" src="../../script/requestTool.js"></script>
	<script type="text/javascript" src="../../script/mui.min.js"></script>
	<script type="text/javascript">
		var vid = "";
		var cid = "";
		//	var pid = "";
		var zht = true;
		var uid = "";
		var jid = "";
		// 三方评价章节内容接口
//		var url = "http://base.cfnet.org.cn/course/Sitenow_Normal/getSitenowInfo";
		apiready = function() {
			uid = $api.getStorage("cfnetppuid");
			jid = $api.getStorage("cfnetppjxid");
			vid = api.pageParam.id;
			cid = api.pageParam.cid;
			pid = api.pageParam.pid;
			//		alert(id + cid)
			openhtmls();
		};
		// 获取任务数据
		function openhtmls() {
			var params = {
				vid : vid,
				uid : uid,
				jid : jid,
				pid : pid,
				cid : cid
			};
			api.showProgress();
			cfnetppPOST(url_getSitenowInfo, params, true, function(data, status) {
				api.hideProgress();
				//			alert(JSON.stringify(data));
				if (status == 'success') {
					// 实训内容数据
					// alert(JSON.stringify(data.data));
					var datas = data.data.bewrite;
					var titles = data.data.cdetailtitle;
					api.sendEvent({
						name : 'cfevale',
						extra : {
							'title' : titles
						}
					});
					if (datas == "") {
						// var tes = '<p class="cevt">暂时没有该章节的描述</p>'
						$('#noData').show();
						// myFunction(tes);
					} else {
						repalc(datas);
					}
				} else {
					// 数据加载失败
					$('#noNet').show();
				}
			});
		}

		// 修改、替换请求的HTML字符串
		function repalc(html) {
			html = "<META content=\"text/html; charset=UTF-8\" http-equiv=Content-Type>" + "</br>"+html;
			//替换视频路径前缀
			var newhtml1 = '<p class=\"edui-video-resource\" url=\"';
			var vedio = '<p class=\"edui-video-resource\" ><video src=\"';
			html = html.replace(newhtml1, vedio);
			//替换视频路径后缀
			var newhtml2 = '\" _width=\"420\" _height=\"280\" style=\"width:420; height:280;float:null;\">';
			var newhtml3 = '\" _width=\"420\" _height=\"280\" style=\"width:420; height:280;float:;\">';
			var newhtml4 = '\" controls=\"controls\"   height=\"200px\" width=\"300px\"></video>';
			html = html.replace(newhtml2, newhtml4);
			html = html.replace(newhtml3, newhtml4);
			//替换JS引用
			var js = '/public/T5PlayerWebSDK';
			var newJs = 'http://cfnet.org.cn/public/T5PlayerWebSDK';
			html = html.replace(js, newJs);
			//替换视频加载路径
			var srcs1 = '=/data/newplan';
			var srcs2 = '=cfnet.org.cn/data/newplan';
			html = html.replace(srcs1, srcs2);
			//替换路径前缀
			var https = 'http://cfnet.org.cnhttp';
			var https1 = 'http';
			html = html.replace(https, https1);
			// 替换表格样式
			html = html.replace("<table", "<table  cellspacing=0 border=1 cellpadding=1 ");
			var clajs1 = '<script type=\"text/javascript\" src=\"http://cfnet.org.cn/public/T5PlayerWebSDK/js/cyberplayer.min.js\">' + '<\/script>';
			var clajs2 = '<script type=\"text/javascript\" src=\"http://cfnet.org.cn/public/T5PlayerWebSDK/js/video.js\">' + '<\/script>';
			html = html.replace(clajs1, "");
			html = html.replace(clajs2, "");
			var strJs = '<script type=\"text/javascript\" src=\"http://img.cfnet.org.cn/public/book/build4grp/js/jquery/jquery-1.8.3.js\"><\/script>' + '<script type=\"text/javascript\">' + '$(function(){' + '$(\".firstRow\").parents(\"table\").css(\"border\",\"1px solid #ddd\");' + ' $(\".firstRow\").parents(\"table\").find(\"td\").css({border:\"1px solid #ddd\",padding:\"0 15px\"});})' + '<\/script>';
			html = html + strJs;
			html = html.replace(":8089", "");
			html = html.replace("href=\"/test", "href=\"http://cfnet.org.cn/test");
			html = html + '<script type=\"text/JavaScript\">doucumnet.body.click();<\/script>';
			html = replace_width(html);   //zzh 5.6 1102
			// alert(html);
			myFunction(html);
			$("td").removeAttr("style");
			$("td").removeAttr("width");
		}

		function myFunction(data_html) {
			x = document.getElementById("htmls");
			// 找到元素
			//		x.innerHTML='<META content="text/html; charset=UTF-8" http-equiv=Content-Type>' + data_html;
			x.innerHTML = data_html;
		}

		//重新加载数据
		function loadNewData() {
			// 隐藏显示的无数据布局
			$('#noNet').hide();
			$('#noData').hide();
			openhtmls();
		}
	</script>
</html>